<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <!-- 以标签的形式使用组件 相当 new VueComponent组件 -->
    <common-head></common-head>

  </div>
  <script src="./vue.js"></script>
  <script>
    const Logo1 = {
      template: `
        <div>
          <h3>这是子组件1</h3>  
        </div>
      `
    }
    const Logo2 = {
      template: `
        <div>
          <h3>这是子组件2</h3>  
        </div>
      `
    }
    // 通过一个component组件 通过is属性决定我显示哪个组件
    const CommonHead = {
      template: `
        <div>
          <h2>我是公共的头部</h2>  
          <component :is="comName"></component>
        </div>
      `,
      data() {
        return {
          comName: 'Logo2'
        }
      },
      components: {
        Logo1,
        Logo2
      }
    }
    Vue.component('CommonHead',CommonHead)
    const vm = new Vue({
      el: '#app'
    })
    console.log(vm);
  </script>
</body>

</html>